/**
 * 初始化 渲染器
 *
 * @returns {boolean}
 */
export default function mixinRenderer (Incident) {
  Incident.prototype.initRenderer = function() {
    const { width, height } = this.$gl
    const renderer = new THREE.WebGLRenderer({ antialias: true })

    renderer.setPixelRatio(window.devicePixelRatio || 1)
    renderer.setSize(width, height)
    renderer.setClearColor(0x66685D, 1.0)

    if (width > height) {
      this.cameraYOffset = 1
    }

    renderer.domElement.id = 'main-canvas'
    document.body.appendChild(renderer.domElement)

    this.itemGeometry = new THREE.PlaneBufferGeometry(1, 1)

    this.renderer = renderer
    return true
  };
}
